package net.lab1024.sa.base.module.support.syslog.controller;

import net.lab1024.sa.base.common.domain.ValidateList;
import net.lab1024.sa.base.module.support.syslog.domain.form.SyslogConfigAddForm;
import net.lab1024.sa.base.module.support.syslog.domain.form.SyslogConfigQueryForm;
import net.lab1024.sa.base.module.support.syslog.domain.form.SyslogConfigUpdateForm;
import net.lab1024.sa.base.module.support.syslog.domain.vo.SyslogConfigVO;
import net.lab1024.sa.base.module.support.syslog.service.SyslogConfigService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import cn.dev33.satoken.annotation.SaCheckPermission;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 陈玉强 Controller
 *
 * @Author 陈玉强
 * @Date 2025-10-20 00:17:05
 * @Copyright 1
 */

@RestController
@Tag(name = "陈玉强")
public class SyslogConfigController {

    @Resource
    private SyslogConfigService syslogConfigService;

    @Operation(summary = "分页查询 @author 陈玉强")
    @PostMapping("/syslogConfig/queryPage")
    @SaCheckPermission("syslogConfig:query")
    public ResponseDTO<PageResult<SyslogConfigVO>> queryPage(@RequestBody @Valid SyslogConfigQueryForm queryForm) {
        return ResponseDTO.ok(syslogConfigService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author 陈玉强")
    @PostMapping("/syslogConfig/add")
    @SaCheckPermission("syslogConfig:add")
    public ResponseDTO<String> add(@RequestBody @Valid SyslogConfigAddForm addForm) {
        return syslogConfigService.add(addForm);
    }

    @Operation(summary = "更新 @author 陈玉强")
    @PostMapping("/syslogConfig/update")
    @SaCheckPermission("syslogConfig:update")
    public ResponseDTO<String> update(@RequestBody @Valid SyslogConfigUpdateForm updateForm) {
        return syslogConfigService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author 陈玉强")
    @PostMapping("/syslogConfig/batchDelete")
    @SaCheckPermission("syslogConfig:delete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Integer> idList) {
        return syslogConfigService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author 陈玉强")
    @GetMapping("/syslogConfig/delete/{id}")
    @SaCheckPermission("syslogConfig:delete")
    public ResponseDTO<String> batchDelete(@PathVariable Integer id) {
        return syslogConfigService.delete(id);
    }
}
